package com.example.demo.utils;

/**
 * Redis存取数据测试
 * Created by rex on 2017/7/5.
 */
public class RedisUtil {
    public static void main(String[] args) {
        //连接本地的 Redis 服务
//        Jedis jedis = new Jedis("localhost",6379);
//        System.out.println("连接成功");
//        //查看服务是否运行
//        System.out.println("服务正在运行: "+jedis.ping());
//        jedis.set("name","xinxin12344");//向key-->name中放入了value-->xinxin
//        System.out.println(jedis.get("name"));//执行结果：xinxin
//        SqlOperator sqlOperator = new SqlOperator();
//        Info_Area[] ia = sqlOperator.getOrganization();
//        List<Info_Area> list = Arrays.asList(ia);
//        Gson gson = new Gson();
//        String s = gson.toJson(list);
//        jedis.set("organization", s);
//        String organization = jedis.get("organization");
//        List<Info_Area> object = gson.fromJson(organization,new TypeToken<List<Info_Area>>() {}.getType());
//        System.out.println(gson.toJson(object));
//    }
//    public static void set(String key,Object object){
//        Jedis jedis = new Jedis("localhost",6379);
//        Gson gson =
//        jedis
//    }
    }

}

